<?php
// Location: system/core.php

// Settings
// --------
  // error_reporting(0);

// Includes
// --------
  require($system['variables']['paths']['system'] . '/core/functions.php');

// System Class
// ------------
  class core {
    function load($type, $name, $data = "") {
      global $system;
      global $application;
      switch ($type) {
        case "controller":
          include($system['variables']['paths']['application'] . '/controllers/' . $name . '.php');
        break;
        case "model":
          include($system['variables']['paths']['application'] . '/models/' . $name . '.php');
        break;
        case "view":
          include($system['variables']['paths']['application'] . '/views/' . $name . '.php');
        break;
        case "block":
          include($system['variables']['paths']['application'] . '/blocks/' . $name . '.php');
        break;
        default:
          return false;
        break;
      }
    }
  }
  $system['classes']['core'] = new core();

// Initiate Application
// --------------------
  require($system['variables']['paths']['application'] . '/config.php');
  require($system['variables']['paths']['application'] . '/auto.php');
  
  // Autoload Classes
  if (__isset($application['variables']['autoload']['core'])) {
    foreach (explode(',', $application['variables']['autoload']['core']) as $key) {
      include($system['variables']['paths']['system'] . '/core/classes/' . $key . '.class.php');
    }
  }
  
  // Autoload Plugins
  if (__isset($application['variables']['autoload']['plugins'])) {
    foreach (explode(',', $application['variables']['autoload']['plugins']) as $key) {
      include($system['variables']['paths']['system'] . '/plugins/' . $key . '.class.php');
    }
  }

?>
